package work20241207_chap8.i;

/**
 * @author zdl
 * @date 2024/12/7
 */
public class Demo {
    public static void main(String[] args) {
        MediaPlayer[] mediaPlayers = new MediaPlayer[3];
        mediaPlayers[0] = new CDPlayer();
        mediaPlayers[1] = new DVDPlayer();
        mediaPlayers[2] = new TapePlayer();
       /* for (int i = 0; i < mediaPlayers.length; i++) {
            mediaPlayers[i].open();
            mediaPlayers[i].play();
            mediaPlayers[i].stop();
            System.out.println();
        }*/
        for (MediaPlayer m:mediaPlayers) {
            m.open();
            m.play();
            m.stop();
            System.out.println();

        }
    }
}
